package com.si.anddos.library.main.factory;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;

import com.si.anddos.dpadapters.Account;
import com.si.anddos.library.provider.ServiceProvider;
import com.si.anddos.library.provider.rapidshare.RapidshareDownloadProvider;
import com.si.anddos.library.provider.rapidshare.RapidshareUploadProvider;

/**
 * 
 * @author jiridrbalek, maros
 *
 */

public class ServiceProviderFactory {
	
	public static ServiceProvider getProvider(URL url) throws MalformedURLException	{
		
		String host = url.getHost(); 
		
		if (host.equals("rapidshare.com")) {
			return new RapidshareDownloadProvider(url);
		}
		
		return null;
	}
	
	// TODO upravit na univerzalni metodu
	public static ServiceProvider getUploadProvider(String name) {		
		return new RapidshareUploadProvider();
	}
	
	public static ServiceProvider getProvider(Account account) throws MalformedURLException	{		
		return getProvider(new URL("http://" + account.getService()));
	}
}
